<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
<script>
    /*var a=[1,3,3,1,2,5,6];
     for (b=0,i=1;b<a.length;b++ )
     {
     if (a[b]==i)
     {
     a.splice(b,1);
     i=a[b];
     }
     }
     document.write(a);*/
    //第二种：
    /*var a=[1,3,3,1,2,5,6];
     a.sort();
     for (var i=0;i<a.length ; i++)
     {
     if (a[i]==a[i+1])
     {
     a.splice(i+1,1);
     i--
     }
     }*/

    //第三种方法：

    var a=[1,3,3,1,2,5,6];
    var b=[];
    for (var i=0;i<a.length ;i++ )
    {
        if (b.indexOf(a[i])==-1)
        {
            b.push(a[i]);
        }
    }
    document.write(b);

    //////////////////////

</script>
</html>